import 'package:ls_work/util/ext_utils.dart';

/// elderHumanId : 1
/// elderHumanName : "洪阿平"
/// elderHumanRoom : null

abstract class IFoodOlder {
  String get selectedOldName;

  num get selectOldId;
}

class ScanOldData extends IFoodOlder {
  ScanOldData(
      {this.elderHumanId,
      this.elderHumanName,
      this.elderHumanRoom,
      this.limitData,
      this.bindSiteId,
      this.bindUseType});

  ScanOldData.fromJson(dynamic json) {
    elderHumanId = json['elderHumanId'];
    elderHumanName = json['elderHumanName'];
    elderHumanRoom = json['elderHumanRoom'];
    bindUseType = json['bindUseType'];
    bindSiteId = json['bindSiteId'];
    limitData = json['packageInfo'] == null
        ? null
        : OldFoodMoneyData.fromJson(json['packageInfo']);
  }

  int? elderHumanId;
  String? elderHumanName;
  String? elderHumanRoom;
  OldFoodMoneyData? limitData;
  int? bindSiteId;
  int? bindUseType;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['elderHumanId'] = elderHumanId;
    map['elderHumanName'] = elderHumanName;
    map['elderHumanRoom'] = elderHumanRoom;
    map['bindSiteId'] = bindSiteId;
    map['bindUseType'] = bindUseType;
    map['packageInfo'] = limitData == null ? null : limitData?.toJson();
    return map;
  }

  @override
  num get selectOldId => elderHumanId??0;

  @override
  String get selectedOldName => elderHumanName??'';
}

class OldFoodMoneyData {
  num? breakfastLimitMoney;
  num? dinnerLimitMoney;
  num? lunchLimitMoney;
  String? packageConfName;

  OldFoodMoneyData(
      {this.breakfastLimitMoney,
      this.dinnerLimitMoney,
      this.lunchLimitMoney,
      this.packageConfName});

  Map<String, dynamic> toJson() {
    return {
      'breakfastLimitMoney': this.breakfastLimitMoney,
      'dinnerLimitMoney': this.dinnerLimitMoney,
      'lunchLimitMoney': this.lunchLimitMoney,
      'packageConfName': this.packageConfName,
    };
  }

  factory OldFoodMoneyData.fromJson(Map<String, dynamic> map) {
    return OldFoodMoneyData(
      breakfastLimitMoney: map['breakfastLimitMoney'] ,
      dinnerLimitMoney: map['dinnerLimitMoney'] ,
      lunchLimitMoney: map['lunchLimitMoney'] ,
      packageConfName: map['packageConfName'],
    );
  }
}
